﻿using System.Web.Optimization;


namespace KamLib.Angular
{


    public static partial class Angular
    {

        #region MVC Bundles

        public static void RegisterBundles(BundleCollection bundles,
            string bundleName = "Angular",
            string contentPath = "~/Resources",
            bool AngularJS = true,
            bool Bootstrap = false,
            bool jQuery = false,
            bool UIBootstrap = false
        )
        {
            var styles = new StyleBundle("~/Styles/" + bundleName);
            var scripts = new ScriptBundle("~/Scripts/" + bundleName);

            if (Bootstrap || UIBootstrap)
                RegisterBootstrap(styles, scripts, contentPath + "/Bootstrap");

            if (jQuery || UIBootstrap)
                RegisterJQuery(styles, scripts, contentPath + "/jQuery");

            if (AngularJS || UIBootstrap)
                RegisterAngularJS(styles, scripts, contentPath + "/AngularJS");

            if (UIBootstrap)
                RegisterUIBootstrap(styles, scripts, contentPath + "/AngularJS/UIBootstrap");

            bundles.Add(styles);
            bundles.Add(scripts);
        }


        public static void RegisterAngularJS(StyleBundle styles, ScriptBundle scripts, string path)
        {
            scripts.Include(path + "/angular.js");
        }


        public static void RegisterBootstrap(StyleBundle styles, ScriptBundle scripts, string path)
        {
            styles.Include(path + "/css/bootstrap.css");
            scripts.Include(path + "/js/bootstrap.js");
        }


        public static void RegisterJQuery(StyleBundle styles, ScriptBundle scripts, string path)
        {
            scripts.Include(path + "/jquery-{version}.js");
        }


        public static void RegisterUIBootstrap(StyleBundle styles, ScriptBundle scripts, string path)
        {
            scripts.Include(path + "/ui-bootstrap-tpls-0.3.0.js");

            styles.Include(path + "/select2.css");
            scripts.Include(path + "/select2.js");
            scripts.Include(path + "/ui-select2.js");
        }

        #endregion

    }


}
